package com.funsport.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.funsport.entity.RolePermission;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;

/**
 * 角色权限关联Mapper
 */
@Mapper
public interface RolePermissionMapper extends BaseMapper<RolePermission> {
    
    /**
     * 删除角色的所有权限
     */
    @Delete("DELETE FROM tb_role_permission WHERE role_id = #{roleId}")
    int deleteByRoleId(Long roleId);
    
    /**
     * 获取角色的权限ID列表
     */
    @Select("SELECT permission_id FROM tb_role_permission WHERE role_id = #{roleId}")
    List<Long> selectPermissionIdsByRoleId(Long roleId);
}

